using HuaXianQu.ProtoBuffEx.Runtimes;
using UnityEngine.Tilemaps;

namespace Game.Terrain.Terrain
{
    public class TerrainManager
    {
        TerrainTileMapBase terrainTileMapBase;
        private int Level = 1;
        GameGridBase gameGridBase;
        public void Init(Tilemap tilemap , int width, int height)
        {
            terrainTileMapBase = new TerrainTileMapBase()
            {
            };
            terrainTileMapBase.Initialize(tilemap, width, height);
            
            
        }

        public void GenerateTerrain()
        {
            BuildingUpgradeConfig buildingUpgradeConfig = GameProtoDataCenter.Get<BuildingUpgradeConfig>();
        }

        public void GenerateDecorativeBuildings()
        {
            BuildingUpgradeConfig buildingUpgradeConfig = GameProtoDataCenter.Get<BuildingUpgradeConfig>();
            foreach (var temp in buildingUpgradeConfig.BuildUpgradeDictMap)
            {
                buildingUpgradeConfig.GetBuildUpgradeDictMap(temp.Key, Level, out BuildingUpgradeConfigItem configItem);
                DecorativeBuildingsBase decorativeBuildingsBase = new DecorativeBuildingsBase()
                {
                    ConfigItem = configItem,
                };
                decorativeBuildingsBase.Init();
                terrainTileMapBase.PlaceBuilding(decorativeBuildingsBase);
            }
        }
    }
}